home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / mg2a_src.zip / SYS / VMS / TRNLNM.C < prev    next >
C/C++ Source or Header  |  1988-08-23  |  2KB  |  76 lines

  1. /*
  2.  * Name:    MicroEmacs
  3.  *        VAX/VMS translate logical name routine
  4.  * Version:    Gnu30
  5.  * Last Edit:    10-Jul-86
  6.  * By:        ...!ihnp4!seismo!ut-sally!ut-ngp!mic
  7.  *
  8.  */
  9.  
  10. /*
  11.  *
  12.  * Trnlnm()
  13.  *
  14.  * Description:
  15.  *    Attempt to translate the logical name logname into an equivalence
  16.  *    string, using the standard VMS routine LIB$SYS_TRNLOG().
  17.  *    If a translation exists, return a pointer to the static area
  18.  *    that contains the null-terminated translation string.  If not,
  19.  *    return 0.
  20.  *
  21.  *  Bugs:
  22.  *    Returns a pointer to static data that is modified each time
  23.  *    the routine successfully translates a logical name.
  24.  */
  25.  
  26. #include <ssdef.h>
  27. #include <descrip.h>
  28. #include <stdio.h>
  29.  
  30. static char _equiv_buf[256];
  31. static struct dsc$descriptor_s
  32. _equiv = {
  33.     sizeof(_equiv_buf), DSC$K_DTYPE_T, DSC$K_CLASS_S, _equiv_buf
  34. },
  35. _name = {
  36.     0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL
  37. };
  38.  
  39. char *trnlnm(logname)
  40. char *logname;
  41. {
  42.     short eqlen;
  43.     int status;
  44.  
  45.     if (logname == NULL)
  46.         return (NULL);
  47.  
  48.     _name.dsc$a_pointer = logname;
  49.     _name.dsc$w_length = strlen(logname);
  50.  
  51.     status = lib$sys_trnlog(&_name, &eqlen, &_equiv);
  52.     if (status != SS$_NORMAL)
  53.         return (NULL);
  54.  
  55.     _equiv_buf[eqlen] = '\0';
  56.     return (_equiv_buf);
  57. }
  58.  
  59. /* gettermtype -- get the terminal type used for MG.
  60.  *
  61.  * If there is a logical name translation for EMACS_TERM, return that.
  62.  * Otherwise translate the logical name TERM.
  63.  * (Both GNU Emacs and Unipress Emacs use EMACS_TERM, but Eunice likes TERM.)
  64.  *
  65.  */
  66.  
  67.  
  68. char *gettermtype()
  69. {   register char *result;
  70.  
  71.     if (result = trnlnm("EMACS_TERM"))
  72.         return(result);
  73.     else
  74.         return(trnlnm("TERM"));
  75.     }
  76.